package com.flea.hclv.controller;

import com.alibaba.fastjson.JSONObject;
import com.flea.hclv.model.entity.HCar;
import com.flea.hclv.model.entity.vo.OrgDeptVo;
import com.flea.hclv.service.HFleetsService;
import com.flea.hclv.util.ServerResponse;
import com.flea.system.bean.FleaPage;
import com.flea.system.entity.OrgDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @program: project
 * @description: 车队
 * @author: shiliqiang
 * @create: 2019-02-19 10:38
 * @version: 1.0
 */
@RequestMapping("/flea/hclv/fleets/")
@Controller
public class HFleetsController {

    @Autowired
    private HFleetsService hFleetsService;

    //车列表队
    @RequestMapping("selectAll")
    @ResponseBody
    public ServerResponse<FleaPage<OrgDept>> selectAll(FleaPage<OrgDeptVo> paging,
                                                       String model
//                                                       @RequestParam(value = "carType", required = false) String carType,
//                                                       @RequestParam(value = "endTime", required = false) String endTime,
//                                                       @RequestParam(value = "startTime", required = false) String startTime,
//                                                       @RequestParam(value = "carNumber", required = false) Integer carNumber
    ) {
        HCar hCar = JSONObject.parseObject(model,HCar.class);

        ServerResponse<FleaPage<OrgDept>> pageServerResponse = hFleetsService.selectAll(paging,hCar==null?null:hCar.getStartTime(),hCar==null?null:hCar.getCarNumber(),
                hCar==null?null:hCar.getCarType(),hCar==null?null:hCar.getEndTime());
        return pageServerResponse;
    }


}
